home *** CD-ROM | disk | FTP | other *** search
/ Softdisk G-S 33 / SDGS 33.2mg / SDGS.33 / TextWizard / IR2.0.Read.Me2 next >
Encoding:
Text File  |  1992-12-11  |  14.1 KB  |  320 lines  |  [04] ASCII Text (0x0000)

  1. *******************************************************************************
  2. *
  3. IR version 2.0
  4. *
  5. The all-purpose doohickey installer
  6. *
  7. By Matt Deatherage, Developer Technical Support
  8. *
  9. Copyright 1991-1992 Apple Computer, Inc.  All rights reserved.
  10. *
  11. *
  12. *******************************************************************************
  13.  
  14.  
  15. What is IR 2.0?
  16.  
  17. IR 2.0 is a lot like IR 1.0, but better.  IR originally stood for "Init
  18. Restarter" and was written to get the GSBug Init installed after booting
  19. because it didn't work with my terminal program.  It was quickly expanded
  20. to also load CDAs, NDAs and GS/OS Drivers, and made it onto the Developer
  21. CD.  There it stood for a long time.
  22.  
  23. The new features in System Software 6.0, specifically inter-process
  24. communication (IPC), make it possible to go IR 1.0 one better -- IR 2.0
  25. installs a Finder Extension so that CDAs, NDAs, inits and GS/OS drivers
  26. and even Finder Extensions are installed without ever leaving the Finder.
  27. It has preferences, presented through an "Extras" menu item and does a lot
  28. more than 1.0.
  29.  
  30.  
  31. How do I use it?
  32.  
  33. To install IR 2.0, put it in the System.Setup folder of your boot volume's
  34. system folder, or double-click on it if IR 1.0 is installed.  It's a
  35. permanent init.
  36.  
  37. Once it's installed, you'll see the "IR Preferences..." item in the Finder's
  38. "Extras" menu.  The preferences available are discussed later in this
  39. document.  More importantly, you can double-click on any of the document
  40. types listed above and they will be installed instantly.  Usually you'll
  41. get extra copies of anything that was already installed when you double-
  42. clicked on it, but you can ask IR to try to kill old versions first, or
  43. instruct it not to do anything if an old version is around.  NDAs appear
  44. in the Apple menu instantly and open their windows.  Finder extensions'
  45. "Extras" menu items show up instantly.  New GS/OS volumes appear on the
  46. desktop instantly.  Everything's very whizzy and snappy.
  47.  
  48. Also included in this seed is a Nifty List 3.4p module called "IR.Module."
  49. This module will eventually include all kinds of IR things to do, but
  50. currently only has one command, "\killir".  \killir takes no parameters and
  51. does what it says -- it kills IR.  It displays error messages or tells you
  52. what user ID IR had before it was brutally murdered.
  53.  
  54.  
  55. What is *not* yet included?
  56.  
  57. The following capabilities are coming someday, but aren't included in the
  58. 2.0 release of IR:
  59.  
  60. *  Some inits don't want to be launched in the Finder, where all the tools
  61.    are started.  IR has an option to let applications have first shot at
  62.    IR documents.  The final package will include a C application that
  63.    accepts Finder long path messages (message type #11, word-length strings
  64.    and fully-expanded pathnames) to install these files.  The source won't
  65.    be too impressive; it will call the IR init to do all the work.  The
  66.    application will allow you to change IR preferences if you launch it with
  67.    no message of type $0011.
  68.    
  69. IR's Preferences
  70.  
  71. IR's preferences dialog has three radio buttons, four checkboxes and three
  72. simple buttons to dismiss it.  You might want to look at the dialog while
  73. reading these descriptions to make it clearer.
  74.  
  75. "Open exsting NDAs' windows," if checked, instructs IR to just open the window
  76. of an NDA that's already installed instead of installing a duplicate copy.
  77. This allows you to double-click on something like the Control Panel NDA icon
  78. and get the window open instead of getting a second Control Panel in your
  79. Apple menu.
  80.  
  81. "Open new NDAs' windows," if checked, instructs IR to open NDAs after they're
  82. installed if possible.  This is only possible if the Desk Manager is active.
  83.  
  84. "Install Finder extensions permanently," if checked, tells IR to install
  85. Finder extensions (file type $BC, auxiliary type $0001) and forget about them;
  86. they'll be in the system until you reboot.  If this checkbox is not checked,
  87. IR keeps track of each Finder extension it installs and shuts them down when
  88. the Finder quits or when IR is told to go away.
  89.  
  90. "Let applications try first," if checked, lets the Finder look for an
  91. application to launch first.  Only if the Finder finds no application for the
  92. file will IR install it.  In technical terms, checking the box makes IR respond
  93. to finderSaysOpenFailed instead of finderSaysBeforeOpen.  You can reverse this
  94. preference on the fly by holding down the Control key as you open a file IR
  95. would normally install.
  96.  
  97. "Tell me about problems" tells IR to show alerts (if possible) in certain
  98. situations where you might want more information and a chance to change
  99. your mind.  If you leave this box unchecked, IR won't display any such
  100. alerts.
  101.  
  102. The three radio buttons determine how IR responds to duplicates -- files the
  103. System Loader already knows about with the same pathname.  "Install a new
  104. copy" does what IR 1.0 did -- it blindly and always installs a new copy of the
  105. file.  This creates duplicate entires in your DA menus and can cause problems
  106. with some inits.
  107.  
  108. "Try to remove the old one" sends the srqGoAway code to the existing copy in
  109. the system, but installs a new one whether or not the old one goes away.  This
  110. is what I usually use.
  111.  
  112. "Always remove the old one" takes no action if the existing copy won't accept
  113. the srqGoAway code.  This is the most conservative but least useful approach.
  114. If you also check the "Tell me about problems" checkbox, IR will tell you
  115. when a duplicate can't be removed and give you one more chance to change
  116. your mind and install a new copy.  If you hold down the option key while
  117. clicking "Install another copy" (actually, IR doesn't check until immediately
  118. after the window closes), the old one will be killed without mercy.  You
  119. should only do this if you know exactly what you're doing.  It's necessary
  120. for Finder Extensions that accept the Finder's "goodbye" message but won't
  121. accept an srqGoAway code -- otherwise weird things could happen.  Most Finder
  122. Extensions won't have this problem, but EasyMount does.
  123.  
  124. "Cancel" dismisses the dialog with no changes to your preferences.  "Accept"
  125. dismisses the dialog, saving your changes in memory until you reboot.  If you
  126. click "Save," IR writes your preferences to disk (in the same folder where
  127. the IR init file is located).  IR will attempt to load such preferences when
  128. it's initialized, and the file is less than one block long so you might as well
  129. use it.  (Actually, the logical length is only two bytes.)
  130.  
  131. Most of the controls have semi-logical key equivalents, too.
  132.  
  133.  
  134. Programming with IR 2.0
  135.  
  136. IR 2.0 is a permanent init because it sits around and accepts requests to
  137. do things.  In addition to accepting requests the Finder says, IR defines
  138. several requests you may send to it at the string "Apple~IR~".  The file
  139. E16.IR, included with this seed, gives the definitions of all the symbolic
  140. constants outlined here.
  141.  
  142. The preferences are bits in a one-word field, and the bits of the field are
  143. defined in the E16.IR file also.  Assemble whichever bits you want and pass
  144. them to the routines that take "preferences" or "flags."  If you pass flags
  145. to the askIRToInstall routine, be sure to set the low-order bit (irSpecialPrefs)
  146. or IR will use the existing preferences instead.  If you want IR to write
  147. preferences to disk, also set the low-order bit, otherwise the preferences
  148. will stay in memory only.
  149.  
  150. Here are brief descriptions of the IR requests.  They are all made to the
  151. string "Apple~IR~" with the Tool Locator call SendRequest.  See the System
  152. Software 6.0 Toolbox Delta ERS for details on SendRequest.
  153.  
  154. askIRStartUp
  155.  
  156. Starts IR.  You shouldn't have to send this; the Init portion of the IR
  157. file sends this request as soon as the request procedure is installed.  This
  158. is where IR calls ShowBootInfo to display the icon or text string.  It
  159. also reads the IR preferences from disk if it can find them, and uses
  160. the default preferences if it can't.
  161.  
  162. dataIn:   Pointer to IR's user ID.
  163. dataOut:  Reserved
  164. Results:   None.
  165.  
  166. askIRAreYouThere
  167.  
  168. A simple request; IR accepts it if it's present.  An easy way to see if IR
  169. is around so you can send it other requests.
  170.  
  171. dataIn:   Reserved
  172. dataOut:  Pointer to the following structure:
  173.           +000   Word   recvCount (filled in by Tool Locator)
  174.           +002   Word   userID -- IR's user ID for your convenience
  175. Results:  None.
  176.  
  177. askIRToInstall
  178.  
  179. The workhorse.  Here you give IR what it needs to install a file, and it
  180. does it if it can and if the preferences permit it.
  181.  
  182. dataIn:   Pointer to the following structure:
  183.           +000   Word   Flags/Prefernces
  184.           +002   Long   Pointer to class one pathname of file to install
  185.           +006   Word   File type of file to install
  186.           +008   Long   Auxiliary type of file to install
  187. dataOut:  Pointer to the following structure:
  188.           +000   Word   recvCount (filled in by Tool Locator)
  189.           +002   Word   irError -- a result code about what happened
  190.           +004   Word   user ID of file just installed
  191. Results:  irDuplicateWontDie -- you told IR not to permit duplicates,
  192.                                 and it found one it couldn't kill.
  193.                                 
  194.           irNoFinder -- Finder wasn't active when you installed
  195.                         a Finder Extension.
  196.                         
  197.           irGSOSNotAvail -- GS/OS isn't available so the file can't
  198.                             be read from disk and installed.
  199.                             
  200.           irNotIRFile -- not a file IR can install
  201.           
  202.           irBusy -- IR was already busy doing something non-reentrant
  203.           
  204.           Toolbox or OS errors returned unchanged.
  205.           
  206.        
  207. askIRGetPrefs
  208.  
  209. Returns IR's preferences.  If the low bit of dataIn is set, the
  210. preferences are (re-)read from disk instead of returned from
  211. memory.
  212.  
  213. dataIn:   Low bit set ==> read from disk
  214. dataOut:  Pointer to following structure:
  215.           +000   Word   recvCount (filled in by Tool Locator)
  216.           +002   Word   irError -- result code
  217.           +004   Word   flags (defined in E16.IR)
  218. Results:  irBusy -- IR was busy at the time
  219.           Toolbox or OS errors returned unchanged
  220.           (However, "file not found" makes IR create a new preferences file.)
  221.           
  222.  
  223. askIRSetPrefs
  224.  
  225. Sets IR's preferences.  The new preferences are in the low word of
  226. dataIn and are written to disk as well if the low-order bit is set.
  227. The preferences are always saved to memory even if disk errors
  228. occur.
  229.  
  230. dataIn:   Preferences in low word, low bit set ==> write to disk
  231. dataOut:  Reserved
  232. Results:  irBusy -- IR was busy at the time
  233.           Toolbox or OS errors returned unchanged (except file not found)
  234.  
  235.  
  236. askIRDoPrefs
  237.  
  238. Asks IR to present the preferences dialog, interact with the user and
  239. record the user's changes to memory and/or disk.  The preferences
  240. dialog works in either 320 or 640 mode, and it is initialized with the
  241. current preferences; if you want to present the dialog with different
  242. preferences, you need to call askIRSetPrefs before calling askIRDoPrefs.
  243.  
  244.  
  245. The dialog should only be presented if the Desk Manager (and NDA capability)
  246. is active, but right now it just assumes these things are there, so it
  247. will probably blow up big-time if you call it without the desktop tools
  248. active.
  249.  
  250. dataIn:   Reserved
  251. dataOut:  Reserved
  252. Results:  None.
  253.  
  254.  
  255. -----------------------------------------------------------------------------
  256.  
  257. A word about installing things like IR does yourself:
  258.  
  259. If you have any doubts that installing DAs and inits and stuff on the fly
  260. and making it do what the user expects is easy, check the voluminous release
  261. notes at the beginning of each source code file, especially RequestProc.aii.
  262. The entire process is pretty delicate to begin with, and trying to move it
  263. to your own application is still risky.
  264.  
  265. So now you have source code to IR and you know all of its secrets.  Now you
  266. can go off and do these things in your own programs, right?
  267.  
  268. Wrong.  Please don't, for several reasons.
  269.  
  270. First, the code is still kind of delicate.  It has several interdependencies
  271. and I very seriously considered moving all the delicate stuff into a
  272. separate source file and not releasing it -- just releasing the object
  273. code to that part.  I decided against it so you can see what's going on,
  274. not so you could duplicate it in your own programs.
  275.  
  276. Second, if you want your desk accessory or application or other code
  277. to duplicate IR functionality, there's no reason to require the user to
  278. take the memory to duplicate these functions.  IR can do the same
  279. work and not require nearly as much space in your code.
  280.  
  281. It's by far easier and better to provide the same functionality by licensing
  282. IR and including it with your program, and using SendRequest to call it.  
  283. Or, you can just use askIRAreYouThere to implement IR-like features if 
  284. IR is already installed, avoiding any licensing paperwork.
  285.  
  286. This stuff is tricky and it can change without warning.  I'd feel a lot
  287. better if you let IR take the risks and you just ask it to do the dirty
  288. work.  That way, any number of desk accessories, applications or utilities
  289. of any kind can have useful IR-like features without taking up lots of
  290. memory and without taking undue risks.
  291.  
  292. You can either license IR (it will be, in the immediate future, part of
  293. the GSBug distribution package, which costs less to license than most
  294. programmers spend on fast food in a week) and ship it with your product,
  295. or (if, for example, you're a shareware author) you can just use the
  296. askIRAreYouThere request to see if IR is installed and enable IR-like
  297. features if it is.  This allows virtually _any_ application to provide
  298. IR's capabilities when not in the Finder for very little memory.
  299.  
  300. You can contact Tim Swihart (AppleLink: TIM.SWIHART, address:  20525
  301. Mariani Ave., MS: 70-PM, Cupertino, CA, 95014) for more information about
  302. licensing IR as part of the GSBug package.  Once everything's settled,
  303. Tim will undoubtedly point you to Software Licensing, so if you know things
  304. are settled you should feel free to contact Software Licensing directly.
  305.  
  306. -----------------------------------------------------------------------------
  307.  
  308. Please AppleLink comments/bugs/suggestions to me at DEATHERAGE1, or AIIDTS.
  309. If you like the sample, you can tell my management that it was a good use of
  310. my time by writing to DTS.FEEDBACK.
  311.  
  312. (Oh, by the way, IR 2.0 doesn't work reliably on any system earlier than
  313. 6.0D59, but it only checks for 6.0 generically.)
  314.  
  315. Package release notes are not included here, but there are voluminous
  316. change histories at the beginning of each source file.
  317.  
  318. Matt Deatherage
  319. Developer Technical Support
  320. Apple Computer, Inc.